﻿@using WeBlog.ViewModels;
@{           
	var controller = ViewContext.RouteData.Values["controller"].ToString().ToLower();
	var tabNumber = 0;    
	var tabItems = new List<TabItem>() {
		new TabItem{ Index = 0, Id = "settings", DisplayText = @Strings.Settings, Controller = "admin", Href = "/Admin/Index" },
		new TabItem{ Index = 1, Id = "accounts", DisplayText = @Strings.Accounts, Controller =  "account", Href = "/Account/Manage" },
		new TabItem{ Index = 2, Id = "posts", DisplayText = @Strings.Posts, Controller = "post", Href = "/Post/Manage" },
		new TabItem{ Index = 3, Id = "pages", DisplayText = @Strings.Pages, Controller = "page", Href = "/Page/Manage" },
		new TabItem{ Index = 4, Id = "categories", DisplayText = @Strings.Categories, Controller = "category", Href = "/Category/Manage" },
		new TabItem{ Index = 5, Id = "tags", DisplayText = @Strings.Tags, Controller = "tag", Href = "/Tag/Manage" },
		new TabItem{ Index = 6, Id = "comments", DisplayText = @Strings.Comments, Controller =  "comment", Href = "/Comment/Manage" },
	};
	var selected = tabItems.SingleOrDefault(x => x.Controller.Equals(controller, StringComparison.InvariantCultureIgnoreCase));    
}
<!doctype html>
<html>
<head>
	<title>WeBlog | @ViewBag.Title</title>	  
	<link rel="stylesheet" media="all" href="/Themes/Admin/Content/admin.css"/>	  
	<link rel="stylesheet" media="all" href="/Content/global.css"/>	  
	<link rel="shortcut icon" href="/favicon.ico"/>        
	<link href='http://fonts.googleapis.com/css?family=Orbitron' rel='stylesheet' type='text/css'/>
	<link rel="stylesheet" href="//ajax.googleapis.com/ajax/libs/jqueryui/1.8.10/themes/smoothness/jquery-ui.css" media="all" />   
	<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.js"></script>
	<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jqueryui/1.8.10/jquery-ui.min.js"></script>
	<script src="/Scripts/ajaxupload.js" type="text/javascript"></script>
	   
	@RenderSection("head", false)   
	<script type="text/javascript">
		$(document).ready(function () {
			$("#tabs").tabs();
			$(".tabLink").click(function () {
				document.location = $(this).attr("data-url") + $(this).attr("href");
			});            
			$("#tabs").tabs('option', 'selected', @(selected == null ? 0 : selected.Index) );
		});
	</script>       
</head>
<body lang="en">   
	<div id="toolbar">
		@Html.Partial("Toolbar")
	</div>
	<div id="branding">
		<img src="/Content/images/logo.png" alt="logo" height="48" width="48" />
		<h1><a href="/">@SiteConfiguration.Name</a></h1>
		<h2>&raquo;<span>@SiteConfiguration.Description</span></h2>
	</div>
	<div id="wrapper">
		<div id="tabs">
			<ul> 
				@foreach (TabItem item in tabItems)
				{
					<li><a class="tabLink" href="#@item.Id" data-url="@item.Href">@item.DisplayText</a></li>                                            
				}
			</ul>    
			@foreach (TabItem item in tabItems)
			{
				<div id="@item.Id">
					@{ tabNumber++; }
					@if (controller.Equals(item.Controller)) { break; }                    
				</div>                        
			}
			@Html.StatusMessage()
			@RenderBody()
				</div>
			@foreach (TabItem item in tabItems.Skip(tabNumber))
			{                
				<div id="@item.Id"></div>                                        
			}
		</div>
		<footer id="footer">
			<a href="http://weblog.codeplex.com">WeBlog</a> @Html.CurrentVersion() | Developed by <a href="http://www.twitter.com/mikeceranski">Michael Ceranski</a>
		</footer>   
	</div>
</body>
</html>
